﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using StructureMap;
using System.Web.Mvc;

namespace AvansRS.Web.IoC
{
    public class DependencyControllerFactory : DefaultControllerFactory
    {
        protected override IController GetControllerInstance(Type controllerType)
        {
            try
            {
                return ObjectFactory.GetInstance(controllerType) as Controller;
            }
            catch(ArgumentNullException ex)
            {
                return base.GetControllerInstance(controllerType);
            }
            catch (StructureMapException ex)
            {
                return base.GetControllerInstance(controllerType);
            }
        }
    }
}
